package thesis;

import java.util.ArrayList;

import com.aliasi.util.Pair;

public class InfoUnit {
	private double weight = 1;
	private double gain = 0;
	private double gainS = 0;
	private int internId;
	private double covProb;
	private String name;
	private ArrayList<Pair<Integer, Integer>> dimValues = new ArrayList<Pair<Integer, Integer>>();

	public double getGainS() {
		return gainS;
	}

	public void setGainS(double gainS) {
		this.gainS = gainS;
	}
	public void addDimValue(int dimId, int valueId) {
		dimValues.add(new Pair<Integer, Integer>(dimId, valueId));
	}

	public ArrayList<Pair<Integer, Integer>> getDimValues() {
		return dimValues;
	}

	public String toString() {
		String debugName = name + " [";
		for (Pair<Integer, Integer> pair : dimValues) {
			debugName += "<" + pair.a() + "," + pair.b() + "> ";
		}
		debugName += "]";
		return debugName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getCovProb() {
		return covProb;
	}

	public void setCovProb(double covProb) {
		this.covProb = covProb;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	public double getGain() {
		return gain;
	}

	public void setGain(double gain) {
		this.gain = gain;
	}

	public int getInternId() {
		return internId;
	}

	public void setInternId(int internId) {
		this.internId = internId;
	}

	public InfoUnit(int internId, int size) {
		this.internId = internId;
		this.setWeight(DataUtil.getInfoWeight(size));
	}
}
